#include <stdio.h> 
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#include "instrument.h"

extern void __VERIFIER_error(int);

// inputs
int inputs[] = {9,10,4,3,1,2,6,7,5,8};

void calculate_output(int);
void calculate_outputm1(int);
void calculate_outputm2(int);
void calculate_outputm3(int);
void calculate_outputm4(int);
void calculate_outputm5(int);
void calculate_outputm6(int);
void calculate_outputm7(int);
void calculate_outputm8(int);
void calculate_outputm9(int);
void calculate_outputm10(int);
void calculate_outputm11(int);
void calculate_outputm12(int);
void calculate_outputm13(int);
void calculate_outputm14(int);
void calculate_outputm15(int);
void calculate_outputm16(int);
void calculate_outputm17(int);
void calculate_outputm18(int);
void calculate_outputm19(int);
void calculate_outputm20(int);
void calculate_outputm21(int);
void calculate_outputm22(int);
void calculate_outputm23(int);

int a1941258847  = 35;
int a831222578 = 16;
int a693035124 = 13;
int a958540235  = 32;
int a2122713545 = 14;
int a1706270929  = 36;
int a1096375983  = 33;
int cf = 1;
int a459982839  = 36;
int a1236594067 = 12;

void calculate_outputm1(int input) {
	if(((( cf==1  && (input == 3)) && a459982839 == 34) && a1236594067 == 9)) {
		cf = 0;
		a1236594067 = 14;
		a2122713545 = 15; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} if((((a1236594067 == 9 &&  cf==1 ) && (input == 4)) && a459982839 == 34)) {
		cf = 0;
		a958540235 = 36 ;
		a1236594067 = 11; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} if((((a1236594067 == 9 &&  cf==1 ) && (input == 10)) && a459982839 == 34)) {
		cf = 0;
		a1236594067 = 14;
		a2122713545 = 13; 
		printf("%d\n", 24); 
		fflush(stdout); 
	} 
}
void calculate_outputm2(int input) {
	if((a831222578 == 10 && (( cf==1  && a1236594067 == 10) && (input == 4)))) {
		cf = 0;
		a958540235 = 35 ;
		a1236594067 = 11; 
		printf("%d\n", 22); 
		fflush(stdout); 
	} if((a831222578 == 10 && ((input == 7) && (a1236594067 == 10 &&  cf==1 )))) {
		cf = 0;
		a1236594067 = 14;
		a2122713545 = 16; 
		printf("%d\n", 23); 
		fflush(stdout); 
	} 
}
void calculate_outputm3(int input) {
	if((a831222578 == 13 && (a1236594067 == 10 && ((input == 10) &&  cf==1 )))) {
		cf = 0;
		printf("%d\n", 19); 
		fflush(stdout); 
	} 
}
void calculate_outputm4(int input) {
	if(((( cf==1  && (input == 10)) && a831222578 == 15) && a1236594067 == 10)) {
		cf = 0;
		a1941258847 = 35 ;
		a1236594067 = 16; 
		printf("%d\n", 17); 
		fflush(stdout); 
	} 
}
void calculate_outputm5(int input) {
	if((a1236594067 == 11 && (a958540235 == 33 && ( cf==1  && (input == 2))))) {
		cf = 0;
		a1236594067 = 10;
		a831222578 = 10; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} if((a1236594067 == 11 && ((input == 3) && (a958540235 == 33 &&  cf==1 )))) {
		cf = 0;
		a459982839 = 34 ;
		a1236594067 = 9; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} if(((a958540235 == 33 && ((input == 4) &&  cf==1 )) && a1236594067 == 11)) {
		cf = 0;
		a1236594067 = 14;
		a2122713545 = 16; 
		printf("%d\n", 23); 
		fflush(stdout); 
	} 
}
void calculate_outputm6(int input) {
	if(((((input == 7) &&  cf==1 ) && a958540235 == 35) && a1236594067 == 11)) {
		cf = 0;
		a1236594067 = 10;
		a831222578 = 10; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} 
}
void calculate_outputm7(int input) {
	if(((input == 4) && (a1236594067 == 11 && (a958540235 == 36 &&  cf==1 )))) {
		cf = 0;
		a1941258847 = 33 ;
		a1236594067 = 16; 
		printf("%d\n", 20); 
		fflush(stdout); 
	} if(((a958540235 == 36 && ( cf==1  && a1236594067 == 11)) && (input == 7))) {
		cf = 0;
		a459982839 = 34 ;
		a1236594067 = 9; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} if(((a958540235 == 36 && (a1236594067 == 11 &&  cf==1 )) && (input == 10))) {
		cf = 0;
			
		printf("%d\n", 20); 
		fflush(stdout); 
	} 
}
void calculate_outputm8(int input) {
	if((a693035124 == 9 && ((a1236594067 == 12 &&  cf==1 ) && (input == 1)))) {
		cf = 0;
			
		printf("%d\n", 20); 
		fflush(stdout); 
	} if(((input == 8) && ((a693035124 == 9 &&  cf==1 ) && a1236594067 == 12))) {
		cf = 0;
		a1236594067 = 14;
		a2122713545 = 15; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} 
}
void calculate_outputm9(int input) {
	if(((input == 8) && ((a1236594067 == 12 &&  cf==1 ) && a693035124 == 13))) {
		cf = 0;
		a1941258847 = 36 ;
		a1236594067 = 16; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} 
}
void calculate_outputm10(int input) {
	if(((input == 1) && (a1236594067 == 12 && (a693035124 == 15 &&  cf==1 )))) {
		cf = 0;
		a1236594067 = 10;
		a831222578 = 13; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} 
}
void calculate_outputm11(int input) {
	if(((input == 2) && (a1706270929 == 33 && (a1236594067 == 13 &&  cf==1 )))) {
		cf = 0;
		a1236594067 = 14;
		a2122713545 = 14; 
		printf("%d\n", 25); 
		fflush(stdout); 
	} if((a1706270929 == 33 && ((input == 4) && (a1236594067 == 13 &&  cf==1 )))) {
		cf = 0;
			
		printf("%d\n", 20); 
		fflush(stdout); 
	} if(((input == 8) && (a1236594067 == 13 && ( cf==1  && a1706270929 == 33)))) {
		cf = 0;
		a1236594067 = 14;
		a2122713545 = 11; 
		printf("%d\n", 24); 
		fflush(stdout); 
	} 
}
void calculate_outputm12(int input) {
	if((a1236594067 == 14 && (( cf==1  && a2122713545 == 11) && (input == 2)))) {
		cf = 0;
		a1941258847 = 34 ;
		a1236594067 = 16; 
		printf("%d\n", 21); 
		fflush(stdout); 
	} if((a1236594067 == 14 && (a2122713545 == 11 && ((input == 7) &&  cf==1 )))) {
		cf = 0;
		a2122713545 = 16; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} 
}
void calculate_outputm13(int input) {
	if((((a2122713545 == 13 &&  cf==1 ) && (input == 4)) && a1236594067 == 14)) {
		cf = 0;
		a1236594067 = 10;
		a831222578 = 15; 
		printf("%d\n", 19); 
		fflush(stdout); 
	} if(((((input == 8) &&  cf==1 ) && a1236594067 == 14) && a2122713545 == 13)) {
		cf = 0;
		a1236594067 = 10;
		a831222578 = 13; 
		printf("%d\n", 19); 
		fflush(stdout); 
	} if(((input == 10) && (a1236594067 == 14 && ( cf==1  && a2122713545 == 13)))) {
		cf = 0;
		a2122713545 = 14; 
		printf("%d\n", 21); 
		fflush(stdout); 
	} 
}
void calculate_outputm14(int input) {
	if((a2122713545 == 14 && ((a1236594067 == 14 &&  cf==1 ) && (input == 1)))) {
		cf = 0;
			
		printf("%d\n", 18); 
		fflush(stdout); 
	} if(((((input == 4) &&  cf==1 ) && a2122713545 == 14) && a1236594067 == 14)) {
		cf = 0;
		a459982839 = 34 ;
		a1236594067 = 9; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} 
}
void calculate_outputm15(int input) {
	if(((a1236594067 == 14 && ((input == 7) &&  cf==1 )) && a2122713545 == 15)) {
		cf = 0;
		a1096375983 = 33 ;
		a1236594067 = 15; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} if((a2122713545 == 15 && ((input == 8) && ( cf==1  && a1236594067 == 14)))) {
		cf = 0;
		a459982839 = 34 ;
		a1236594067 = 9; 
		printf("%d\n", 24); 
		fflush(stdout); 
	} 
}
void calculate_outputm16(int input) {
	if(((input == 3) && (a1236594067 == 14 && ( cf==1  && a2122713545 == 16)))) {
		cf = 0;
		a1941258847 = 36 ;
		a1236594067 = 16; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} if(((a2122713545 == 16 && (a1236594067 == 14 &&  cf==1 )) && (input == 4))) {
		cf = 0;
		a958540235 = 36 ;
		a1236594067 = 11; 
		printf("%d\n", 20); 
		fflush(stdout); 
	} 
}
void calculate_outputm17(int input) {
	if((((input == 8) && ( cf==1  && a1096375983 == 32)) && a1236594067 == 15)) {
		cf = 0;
		a1096375983 = 36 ; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} 
}
void calculate_outputm18(int input) {
	if((a1236594067 == 15 && ((input == 2) && ( cf==1  && a1096375983 == 33)))) {
		cf = 0;
		a1236594067 = 12;
		a693035124 = 9; 
		printf("%d\n", 19); 
		fflush(stdout); 
	} if(((( cf==1  && a1236594067 == 15) && (input == 7)) && a1096375983 == 33)) {
		cf = 0;
		a958540235 = 33 ;
		a1236594067 = 11; 
		printf("%d\n", 23); 
		fflush(stdout); 
	} 
}
void calculate_outputm19(int input) {
	if(((( cf==1  && a1236594067 == 15) && (input == 7)) && a1096375983 == 36)) {
		cf = 0;
		a1236594067 = 14;
		a2122713545 = 11; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} if(((a1236594067 == 15 && (a1096375983 == 36 &&  cf==1 )) && (input == 8))) {
		cf = 0;
		a1096375983 = 32 ; 
		printf("%d\n", 16); 
		fflush(stdout); 
	} 
}
void calculate_outputm20(int input) {
	if(((input == 1) && (a1941258847 == 33 && ( cf==1  && a1236594067 == 16)))) {
		cf = 0;
		a958540235 = 36 ;
		a1236594067 = 11; 
		printf("%d\n", 20); 
		fflush(stdout); 
	} if((a1941258847 == 33 && (((input == 4) &&  cf==1 ) && a1236594067 == 16))) {
		cf = 0;
		a459982839 = 34 ;
		a1236594067 = 9; 
		printf("%d\n", 24); 
		fflush(stdout); 
	} if(((( cf==1  && a1941258847 == 33) && (input == 6)) && a1236594067 == 16)) {
		cf = 0;
		a1096375983 = 36 ;
		a1236594067 = 15; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} 
}
void calculate_outputm21(int input) {
	if((a1236594067 == 16 && (a1941258847 == 34 && ((input == 1) &&  cf==1 )))) {
		cf = 0;
		a1236594067 = 12;
		a693035124 = 15; 
		printf("%d\n", 23); 
		fflush(stdout); 
	} if(((input == 3) && (a1941258847 == 34 && ( cf==1  && a1236594067 == 16)))) {
		cf = 0;
		a1706270929 = 33 ;
		a1236594067 = 13; 
		printf("%d\n", 20); 
		fflush(stdout); 
	} if(((( cf==1  && (input == 8)) && a1236594067 == 16) && a1941258847 == 34)) {
		cf = 0;
		a459982839 = 34 ;
		a1236594067 = 9; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} 
}
void calculate_outputm22(int input) {
	if(((input == 3) && (( cf==1  && a1941258847 == 35) && a1236594067 == 16))) {
		cf = 0;
			
		printf("%d\n", 25); fflush(stdout); 
	} 
}
void calculate_outputm23(int input) {
	if((((input == 2) && ( cf==1  && a1941258847 == 36)) && a1236594067 == 16)) {
		cf = 0;
		a1096375983 = 36 ;
		a1236594067 = 15; 
		printf("%d\n", 26); 
		fflush(stdout); 
	} if((a1236594067 == 16 && (( cf==1  && a1941258847 == 36) && (input == 8)))) {
		cf = 0;
		a459982839 = 34 ;
		a1236594067 = 9; 
		printf("%d\n", 18); 
		fflush(stdout); 
	} 
}

void calculate_output(int input) {
	cf = 1;

	if(( cf==1  && a1236594067 == 9)) {
		if(( cf==1  && a459982839 == 34)) {
			calculate_outputm1(input);
		} 
	} 
	if(( cf==1  && a1236594067 == 10)) {
		if(( cf==1  && a831222578 == 10)) {
			calculate_outputm2(input);
		} 
		if((a831222578 == 13 &&  cf==1 )) {
			calculate_outputm3(input);
		} 
		if((a831222578 == 15 &&  cf==1 )) {
			calculate_outputm4(input);
		} 
	} 
	if((a1236594067 == 11 &&  cf==1 )) {
		if(( cf==1  && a958540235 == 33)) {
			calculate_outputm5(input);
		} 
		if((a958540235 == 35 &&  cf==1 )) {
			calculate_outputm6(input);
		} 
		if((a958540235 == 36 &&  cf==1 )) {
			calculate_outputm7(input);
		} 
	} 
	if(( cf==1  && a1236594067 == 12)) {
		if((a693035124 == 9 &&  cf==1 )) {
			calculate_outputm8(input);
		} 
		if((a693035124 == 13 &&  cf==1 )) {
			calculate_outputm9(input);
		} 
		if((a693035124 == 15 &&  cf==1 )) {
			calculate_outputm10(input);
		} 
	} 
	if(( cf==1  && a1236594067 == 13)) {
		if((a1706270929 == 33 &&  cf==1 )) {
			calculate_outputm11(input);
		} 
	} 
	if((a1236594067 == 14 &&  cf==1 )) {
		if((a2122713545 == 11 &&  cf==1 )) {
			calculate_outputm12(input);
		} 
		if(( cf==1  && a2122713545 == 13)) {
			calculate_outputm13(input);
		} 
		if((a2122713545 == 14 &&  cf==1 )) {
			calculate_outputm14(input);
		} 
		if((a2122713545 == 15 &&  cf==1 )) {
			calculate_outputm15(input);
		} 
		if(( cf==1  && a2122713545 == 16)) {
			calculate_outputm16(input);
		} 
	} 
	if(( cf==1  && a1236594067 == 15)) {
		if((a1096375983 == 32 &&  cf==1 )) {
			calculate_outputm17(input);
		} 
		if(( cf==1  && a1096375983 == 33)) {
			calculate_outputm18(input);
		} 
		if(( cf==1  && a1096375983 == 36)) {
			calculate_outputm19(input);
		} 
	} 
	if((a1236594067 == 16 &&  cf==1 )) {
		if((a1941258847 == 33 &&  cf==1 )) {
			calculate_outputm20(input);
		} 
		if((a1941258847 == 34 &&  cf==1 )) {
			calculate_outputm21(input);
		} 
		if((a1941258847 == 35 &&  cf==1 )) {
			calculate_outputm22(input);
		} 
		if(( cf==1  && a1941258847 == 36)) {
			calculate_outputm23(input);
		} 
	} 


	if( cf==1 ) {
		fprintf(stderr, "Invalid input: %d\n", input); 
	}
}

int main(int argc, char *argv[])
{
	FILE *fp;
	uint8_t c;
	fp = fopen(argv[1], "r");
	if(fp == NULL){
		return 0;
	}
	while (!feof(fp))
	{
		c = fgetc(fp);
		int input = (int)c;
		if ((input < 1) || (input > 10))
		{
			input = (input % 10) + 1;
		}
		if ((((((((((input != 9) && (input != 10)) && (input != 4)) && (input != 3)) && (input != 1)) && (input != 2)) && (input != 6)) && (input != 7)) && (input != 5)) && (input != 8))
			return -2;

		calculate_output(input);
	}
	fclose(fp);

	return 0;
}
